package io;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class TodayBRDemo {
    public static void main(String[] args) throws IOException {
        FileInputStream fis=new FileInputStream("pw.txt");
        InputStreamReader isr=new InputStreamReader(fis,StandardCharsets.UTF_8);
        BufferedReader br=new BufferedReader(isr);
        String line;
        while ((line=br.readLine())!=null){
            System.out.println(line);
            System.out.print(line);
        }
        br.close();
        /*
        FileInputStream fis=new FileInputStream("pw.txt");//文件流，低级流
        InputStreamReader isr=new InputStreamReader(fis, StandardCharsets.UTF_8);//高级转换字符流
        BufferedReader br=new BufferedReader(isr);

        String readLine()
        读取一行字符串，返回的字符中不包含最后的换行符
        如果担负读取到了换行符（一个空行）则返回值为空字符串（""）
        如果返回值为null，则表示读到了末尾

        String line;
        while ((line=br.readLine())!=null){
            System.out.println(line);//换行输出
            System.out.print(line);//没有换行输出
        }
        br.close();

         */

    }
}
